<template>
  <div class="main-container">
    <Table
      ref="tableRef"
      :choiceColumn="false"
      :columns="columns"
      :apiUrl="apiUrl"
      :showPage="true"
      :showHandle="false"
      :showSearch="true"
      :defaultSort="defaultSort"
      :formData="formData"
    >
    </Table>
  </div>
</template>

<script setup>
import Table from "@/components/Table";
import { logList } from "@/api/log";
const { proxy } = getCurrentInstance();
const defaultSort = ref({ prop: "createTime", order: "descending" });

const columns = [
  {
    prop: "id",
    label: "编号",
    width: 100,
    align: "center",
  },
  {
    prop: "content",
    label: "日志内容",
    align: "center",
  },
  {
    prop: "logType",
    label: "日志类型",
    align: "center",
  },
  {
    prop: "createBy",
    label: "操作账号",
    align: "center",
  },
  {
    prop: "createTime",
    label: "操作时间",
    align: "center",
    sortable: "custom",
  },
  {
    prop: "ipaddress",
    label: "操作ip",
    align: "center",
  },
];
const formData = [
  {
    type: "input",
    label: "ip",
    placeholder: "请填写操作ip",
    prop: "ipaddress",
    showRule: [],
    width:'70%',
    searchShow: true,
  },
  {
    type: "select",
    label: "类型",
    placeholder: "请选择日志类型",
    prop: "logType",
    showRule: [],
    width:'70%',
    searchShow: true,
    searchOption: [
      { value: "1", label: "登录" },
      { value: "2", label: "退出" },
      { value: "3", label: "菜单路由" },
      { value: "4", label: "用户板块" },
      { value: "5", label: "角色板块" },
      { value: "6", label: "工具标签" },
      { value: "7", label: "工具" },
      { value: "8", label: "笔记" },
    ],
  },
  {
    type: "datetimerange",
    label: "操作时间",
    placeholder: ["筛选操作时间(开始点)", "操作时间(结束点)"],
    prop: "createTime",
    default: [],
    showRule: [],
    searchShow: true,
  },
];
const apiUrl = {
  list: logList,
};
</script>

<style lang="scss" scoped></style>
